package com.siwei.mes.controller.mixProportion;

import com.siwei.mes.common.query.PageQuery;
import com.siwei.mes.common.result.ApiResult;
import com.siwei.mes.common.result.Json;
import com.siwei.mes.common.validator.PageGroup;
import com.siwei.mes.entity.mixproportion.MixProportionUpdateLog;
import com.siwei.mes.service.mixProportion.MixProportionUpdateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 配合比修改记录（品控）相关
 *
 * @author linzi
 * @since 2024-09-07 23:59:46
 */
@Api(value = "配合比修改记录（品控）")
@RestController
@RequestMapping("mixProportionUpdateLog")
public class MixProportionUpdateLogController {
    @Resource
    private MixProportionUpdateLogService mixProportionUpdateLogService;

    @ApiOperation(value = "分页获取配合比修改记录（品控）")
    @PostMapping("/page")
    public Json appPage(@RequestBody @Validated(PageGroup.class) PageQuery<MixProportionUpdateLog, MixProportionUpdateLog> query) {
        return Json.succ().data(mixProportionUpdateLogService.getPage(query));
    }

    @ApiOperation(value = "根据主键id获取配合比修改记录（品控）")
    @GetMapping("loadById")
    public Json loadById(@RequestParam("id") Long id) {
        return Json.succ().data(mixProportionUpdateLogService.loadById(id));
    }

    @ApiOperation(value = "获取所有配合比修改记录（品控）")
    @PostMapping("getAll")
    public Json getAll(@RequestBody MixProportionUpdateLog entity) {
        return Json.succ().data(ApiResult.addList(mixProportionUpdateLogService.getAll(entity)));
    }

}
